package com.example.demo.physicalExperiment.mapper;

import com.example.demo.domain.dto.PhysicalExperiment;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author lizijian
 */
@Mapper
public interface PhysicalCourseDao {

  @Select("SELECT appoint.`week`,appoint.xingqi AS day,appoint.node AS lesson,"
      + "(SELECT experiment.`name` FROM experiment WHERE experiment.id="
      + "(SELECT teacher_experiment.experiment_id FROM teacher_experiment WHERE teacher_experiment.id= appoint.teacher_experiment_id )) AS courseName,"
      + "(SELECT experiment.address FROM experiment WHERE experiment.id="
      + "(SELECT teacher_experiment.experiment_id FROM teacher_experiment WHERE teacher_experiment.id= appoint.teacher_experiment_id )) AS address  "
      + "FROM appoint WHERE appoint.id IN (SELECT student_appoint_log.appoint_id FROM student_appoint_log WHERE student_appoint_log.student_id=#{schoolId})")
  List<PhysicalExperiment> getCourseBySchoolId(String schoolId);
}
